package automateWebElements;

import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.support.ui.Select;

public class FinalAssignment {
    public static void main(String[] args) {
        FirefoxDriver driver = new FirefoxDriver();
        driver.get("https://www.cleartrip.com");

        WebElement staticDropdown = driver.findElementByCssSelector("div.row:nth-child(6) > div:nth-child(1) > div:nth-child(1) > select:nth-child(2)");
        Select passengers = new Select(staticDropdown);
        passengers.selectByValue("3");

        WebElement childrenDropdown = driver.findElementByCssSelector("div.row:nth-child(6) > div:nth-child(1) > div:nth-child(3) > select:nth-child(2)");
        Select children = new Select(childrenDropdown);
        children.selectByValue("2");

        driver.findElementByCssSelector("button.pr-2").click();
        driver.findElementByCssSelector("div.DayPicker-Day--today").click();

        driver.findElementByCssSelector("strong.pr-1").click();
        driver.findElementByXPath("//input[@placeholder=\'Airline name\']").sendKeys("indigo");
        try {
            Thread.sleep(200);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        driver.findElementByCssSelector("div.bg-white:nth-child(2) > ul:nth-child(1)").click();

        driver.findElementByCssSelector("button.px-7").click();

        System.out.println(driver.findElementByCssSelector("span.to-ellipsis").getText());
    }
}
